// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority() {
  // return localStorage.getItem('antd-pro-authority') || ['admin', 'user'];
  let authority = localStorage.getItem('iwz-pro-authority') || ["guest"];
  if (authority) {
    if (authority.includes('[')) {
      authority = JSON.parse(authority);
    } else {
      authority = [authority];
    }
  } else {
    authority = [];
  }
  return authority;
}
export function getToken() {
  return  localStorage.getItem('iwz-pro-token')||'';
}

export function setAuthority(authority, token) {
  console.log("setAuthority===>" + authority)
  authority={"100":["guest"],"200":["user"],"500":["admin"]}[authority]||["guest"];
  localStorage.setItem('iwz-pro-authority', authority);
  localStorage.setItem('iwz-pro-token', token);
}
